//
//  SENewsFeatureCell.m
//  RealDoc
//
//  Created by 蒋小哥 on 16/7/11.
//  Copyright © 2016年 Alphts. All rights reserved.
//

#import "SENewsFeatureCell.h"
#import "JASidePanelController.h"
#import "SENavigationController.h"
#import "SEHomeController.h"
#import "SELeftController.h"

@implementation SENewsFeatureCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        // MARK: - 1.添加按钮,并且监听事件
        // 1.创建按钮
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        // 2.设置图片
        [btn setImage:[UIImage imageNamed:@"guideStart"] forState:UIControlStateNormal];
        // 3.调整大小
        [btn sizeToFit];
        
        btn.x = (self.bounds.size.width - btn.bounds.size.width) * 0.5;
        btn.y = self.bounds.size.height * 0.9;
        // 4.添加
        [self.contentView addSubview:btn];
        // 5.监听事件
        [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
        
        // 6.赋值
        _goBtn = btn;
        
    }
    return self;
}

- (void)btnClick {
    JASidePanelController *viewController = [[JASidePanelController alloc] init];
    viewController.leftPanel = [[SELeftController alloc] init];
    //给侧滑控制器的中间Panel 添加的是以home控制器为根控制器的导航控制器
    
    viewController.centerPanel = [[SENavigationController alloc] initWithRootViewController:[[SEHomeController alloc] init]];
    [UIApplication sharedApplication].keyWindow.rootViewController = viewController;
}


@end
